package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.DefectBean;
import com.xuxin.nantai.contract.DefectContract;
import com.xuxin.nantai.model.DefectModel;

/**
 * Created by xu_xin
 * Created on 2020.06.09 0009
 */
public class DefectPresenter implements DefectContract.Presenter {
    private DefectModel model;
    private DefectContract.View view;

    public DefectPresenter(DefectContract.View view) {
        model = new DefectModel();
        this.view = view;
    }

    @Override
    public void getDefect(String Guid, String InsType) {
        if (null != model) {
            model.getDefect(this, Guid, InsType);
        }
    }

    @Override
    public void onSuccess(DefectBean defectBean) {
        if (null != view) {
            view.onSuccess(defectBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}